home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
tegl6b.zip
/
INTROPAK.EXE
/
lha
/
TWDDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-06-26
|
4KB
|
161 lines
{---------------------------------------------------------}
{ TEGL WINDOWS TOOLKIT II, Release 2.0 }
{ Copyright 1989, 1991 TEGL System Corporation. }
{ All rights reserved. }
{---------------------------------------------------------}
{$M 4384,64000,640000}
{$I switches.inc}
{$N+}
{$E+}
USES
teglfont,
FastGrph,
{$IFDEF NoGr}
TGraph,
{$ELSE}
drvevga,
Graph,
{$ENDIF}
virtmem,
teglintr,
teglunit,
teglmain,
twcommon,
twkernel,
twwindow,
twcontrl,
twdialog,
twdialud,
{$IFOPT N+}
twdialfp,
{$ENDIF}
moreicon;
{$F+}
Function OKEvent(ifs : ImageStkPtr; ms : MsClickPtr): word;
VAR wf : WinFramePtr;
BEGIN
wf := findWinFrame(ifs);
{dropstackimage(ifs);}
END;
VAR wf : WinFramePtr;
TYPE
samdatdef = record
cbitem : boolean;
ilitem : string[30];
ilitem2: string[30];
float : real;
intitem: integer;
rbitem : integer;
end;
CONST
samdat : samdatdef =
(cbitem : false;
ilitem : 'Some text, jj';
ilitem2 : 'Additional String';
float : 123.45;
intitem : 2345;
rbitem : 3);
{-- the cancel event would do the appropriate processind then it }
{-- must call twdclose to dispose of the dialog and all its }
{-- associate memory allocation. twdclose in turn calls twclose }
{-- which ulitmately disposes of the the window. }
function cancelevent(ifs: ImageStkPtr; ms: MsClickPtr): Word;
VAR wf: WinFramePtr;
begin
wf := findWinFrame(ifs);
cancelevent := twdClose(ifs,ms);
end;
function showevent(ifs: ImageStkPtr; ms: MsClickPtr): Word;
VAR wf: WinFramePtr;
begin
twInit(wf,150,150,400,250);
twSetHeader(wf,'Show variable contents.');
twDrawWindowFrame(wf);
twCrtAssign(wf);
twSelect(wf);
twSetResize(wf,false);
writeln(samdat.cbitem);
writeln(samdat.ilitem);
writeln(samdat.float:12:2);
end;
Procedure InstallDialog1;
BEGIN
twdInit(wf,100,100,450,400);
twsetCloseEvent(wf,cancelevent); {-- the spacebar menu }
twSetHeader(wf,'Dialogue Window');
twdAddLabel(wf,20,5,'This is a label at (20,5)');
twdAddCheckBox(wf, 20, 30, 'A Check Box',samdat.cbitem);
twdAddRadioButton(wf, 20, 50, 'A Radio Button (1)',samdat.rbitem);
twdAddRadioButton(wf, 20, 70, 'A Radio Button (2)',samdat.rbitem);
twdAddRadioButton(wf, 20, 90, 'A Radio Button (3)',samdat.rbitem);
twdAddInputLine(wf,20,110,'An input line',samdat.ilitem,20);
twdAddInputLine(wf,20,130,'Another input line',samdat.ilitem2,20);
twdAddReal(wf,20,150,'A real number',samdat.float,12,2);
twdAddInteger(wf,20,170,'An integer',samdat.intitem,4);
twdAddButton(wf,60,200,'OK',OKEvent);
twdAddbutton(wf,200,200,'CANCEL',CancelEvent);
twdAddButton(wf,60,240,'SHOW',showEvent);
{twSetRedraw(wf,twdRedraw);}
twDrawWindowFrame(wf);
END;
{$IFOPT N+}
CONST single1 : single = 5.6789;
double1 : double = 10.876;
Procedure InstallDialog2;
VAR wf: WinFramePtr;
BEGIN
twdInit(wf,200,150,550,400);
twsetCloseEvent(wf,CancelEvent);
twsetheader(wf,'Floating point types');
twdAddSingle(wf,20,10,'Single precision number ',single1,12,6);
twdAddDouble(wf,20,40,'Double precision number ',double1,12,6);
twdAddButton(wf,20,150,'OK',OKEvent);
twdAddbutton(wf,80,150,'CANCEL',CancelEvent);
twDrawWindowFrame(wf);
END;
{$ENDIF}
BEGIN
maxwindowsize := maxavail DIV 3;
twEasyStart;
twCRtOn;
setautorotate(true);
setkeyboardmouse(false);
SetTeglFont(@f8x12bol);
{ twcInstallMonitor;}
{ twcInstallSizes; }
{---------}
twSetDialogFont(@font14);
InstallDialog1;
{$IFOPT N+}
InstallDialog2;
{$ENDIF}
SetAutoRotate(TRUE);
TeglSuperVisor;
END.